/*
 * @lc app=leetcode.cn id=908 lang=cpp
 *
 * [908] 最小差值 I
 */

// @lc code=start
class Solution
{
public:
  int smallestRangeI(vector<int>& nums, int k)
  {
    int MAX = *max_element(nums.begin(), nums.end()), MIN = *min_element(nums.begin(), nums.end());
    return max(0, MAX - MIN - 2 * k);
  }
};
// @lc code=end
